From f5ac3b0346dbfd6315959879c37ee654328fa4c9 Mon Sep 17 00:00:00 2001 From: Alex Williamson Date: Wed, 6 Feb 2008 11:23:16 -0700 Subject: [PATCH] [IA64] Fix shadow_op hypercall Fix SHADOW_OP_ENABLE_LOGDIRTY and SHADOW_OP_CLEAN hypercall. Live migation doesn't work because the VHPT is not flushed. Signed-off-by: Kouya Shimura --- xen/arch/ia64/xen/domain.c | 3 ++- xen/arch/ia64/xen/vhpt.c | 25 +++++++++++++++++++++++++ xen/include/asm-ia64/tlbflush.h | 3 +++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/xen/arch/ia64/xen/domain.c b/xen/arch/ia64/xen/domain.c index 17375693dd..ffca9533c5 100644 --- a/xen/arch/ia64/xen/domain.c +++ b/xen/arch/ia64/xen/domain.c @@ -1785,7 +1785,7 @@ int shadow_mode_control(struct domain *d, xen_domctl_shadow_op_t *sc) v->arch.shadow_bitmap = d->arch.shadow_bitmap; /* Flush vhtp and tlb to enable dirty bit virtualization. */ - domain_flush_tlb_vhpt(d); + flush_tlb_for_log_dirty(d); } break; @@ -1824,6 +1824,7 @@ int shadow_mode_control(struct domain *d, xen_domctl_shadow_op_t *sc) memset((uint8_t *)d->arch.shadow_bitmap + i, 0, size); } + flush_tlb_for_log_dirty(d); break; } diff --git a/xen/arch/ia64/xen/vhpt.c b/xen/arch/ia64/xen/vhpt.c index e5aac9aa43..19d91f5505 100644 --- a/xen/arch/ia64/xen/vhpt.c +++ b/xen/arch/ia64/xen/vhpt.c @@ -521,6 +521,31 @@ void domain_flush_tlb_vhpt(struct domain *d) cpus_clear (d->domain_dirty_cpumask); } +void flush_tlb_for_log_dirty(struct domain *d) +{ + struct vcpu *v; + + /* NB. There is no race because all vcpus are paused. */ + if (is_hvm_domain(d)) { + for_each_vcpu (d, v) { + /* XXX: local_flush_tlb_all is called redundantly */ + thash_purge_all(v); + } + smp_call_function((void (*)(void *))local_flush_tlb_all, + NULL, 1, 1); + } else if (HAS_PERVCPU_VHPT(d)) { + for_each_vcpu (d, v) { + vcpu_purge_tr_entry(&PSCBX(v,dtlb)); + vcpu_purge_tr_entry(&PSCBX(v,itlb)); + vcpu_vhpt_flush(v); + } + on_each_cpu((void (*)(void *))local_flush_tlb_all, NULL, 1, 1); + } else { + on_each_cpu((void (*)(void *))flush_tlb_vhpt_all, d, 1, 1); + } + cpus_clear (d->domain_dirty_cpumask); +} + void flush_tlb_mask(cpumask_t mask) { int cpu; diff --git a/xen/include/asm-ia64/tlbflush.h b/xen/include/asm-ia64/tlbflush.h index a659f6a0e4..00b72235e0 100644 --- a/xen/include/asm-ia64/tlbflush.h +++ b/xen/include/asm-ia64/tlbflush.h @@ -34,6 +34,9 @@ void domain_flush_vtlb_track_entry(struct domain* d, /* Flush vhpt and mTLB on every dirty cpus. */ void domain_flush_tlb_vhpt(struct domain *d); +/* Flush vhpt and mTLB for log-dirty mode. */ +void flush_tlb_for_log_dirty(struct domain *d); + /* Flush v-tlb on cpus set in mask for current domain. */ void flush_tlb_mask(cpumask_t mask); -- 2.30.2